Dashboard View Model
Instantiate the DashboardViewModel
class found within the InfoArch.Web.Mvc.Dashboard
namespace, allows us to configure all settings that the dashboard component require.
This class facilitates the configuration of dashboard settings, encompassing tasks such as establishing database connections and configuring link for the save of status and link for the execution of drill-through reports.
Constructors
Name | Description |
---|---|
DashboardViewModel() | Initializes a new instance of the DashboardViewModel class. |
DashboardViewModel(parameters) | Initializes a new instance of the DashboardViewModel class. |
DashboardViewModel() Constructor
This is the default constructor for the DashboardViewModel
class, which creates a new instance and initializes all properties to their default values.
DashboardViewModel(parameters) Constructor
This is the main constructor, it has the following parameters:
Parameter | Type | Description |
---|---|---|
memoryStream | MemoryStream | Represents in-memory data flow for a dashboard definition (.dDashX). |
connectionString | string | The connection string used by the component to retrieve its data. For example: Data Source=MyServer; Initial Catalog=myDatabase; User ID=myUser; Password=myPassword |
dashboardId | string | Definition Identifier |
filterComponentParentId | string | HTML identifier of the parent element where the filter component is included, if no filters are included. It may be empty |
fullGridControllerActionPath | string | A String object that specifies the absolute path where the application is hosted to perform the build of the internal paths handle by the component. The recommended path could be the following: HttpContext.Request.Url.AbsolutePath |
drillThroughControllerAction | string | A String object that specifies the controller action method to perform the drill-through execution. |
saveDashboardControllerAction | string | A String object that specifies the controller action method to perform the save state action. |
htmlFormId | string | Form Identifier of the element containing the dashboard component. |
useNewExportToImagePro | bool | true, to enable the export to image pro mode; otherwise, false. |
excelXlsxExportControllerAction | string | A String object that specifies the controller action method to perform the Excel exportation action. |
Methods
**SetState **
Sets the state of the dashboard. It receives a DRevealDataStructure
object with the current state of the Dashboard component.
Definition
public void SetState(DRevealDataStructure dashboardState)
**SetParameters **
Sets the global parameters the parameters can be created in the dashboard definition from its designer, and assigned from the web dashboard component programmatically. It receives a ParameterItems
object provided by the hosting application.
Definition
public void SetParameters(ParameterItems userParameters)
SetCulture
Sets culture and receives a CultureInfo
object provided by the hosting application.
Definition
public void SetCulture(CultureInfo clientCulture)
LoadDataDrillThrough
Loads the Drill-Through structure when the action excecuted is perform Drill-Through on dashboard component. It receives a string
object that has parameters required for build it.
Definition
public void LoadDataDrillThrough(string drillThroughParameters)
Serialize
Serializes all structures needed to save dashboard component status.
Definition
public string Serialize()
Returns string
object encrypted.
AssignUserCustomizationDefinitionModel
Assigns the user customization definition model. It receives an encrypted string
object, which is the result of the Serialize
method.
Definition
public void AssignUserCustomizationDefinitionModel(string userCustomization)
UpdateCustomization
Updates the user customization properties, including applied filters and conditions within the dashboard component.
Definition
public void UpdateCustomization()
LoadInitialConfiguration
The LoadInitialConfiguration
method in DashboardViewModel
initializes the configuration and prepare the all properties required by the dashboard component.
Example
DashboardViewModel viewModel = new DashboardViewModel(
memoryStream: fileStream,
connectionString: " Data Source=MyServer; Initial Catalog=myDatabase; User ID=myUser; Password=myPassword",
dashboardId: "dashboard_id",
htmlFormId: "main_form",
fullGridControllerActionPath: HttpContext.Request.Url.AbsolutePath,
useNewExportToImagePro: true,
filterComponentParentId: string.Empty,
drillThroughControllerAction: string.Empty,
saveDashboardControllerAction: string.Empty,
excelXlsxExportControllerAction: string.Empty
);
viewModel.LoadInitialConfiguration();